extends NodeState


@export var player: Player



func _on_enter() -> void:
	process_animation()


func _on_exit() -> void:
	pass



func process_animation():
	player.animationPlayer.play(Player.ANIMATION_THROW)


func throw_knife():
	player.throw_weapon(Collectible.Type.KNIFE)
	player.has_knife = false


func throw_gun():
	player.throw_weapon(Collectible.Type.GUN)
	player.has_gun = false


func on_throw_animation_finished():
	if player.has_knife:
		throw_knife()
	elif player.has_gun:
		throw_gun()

	transition_state(Player.STATE_IDLE)